$(function(){
	//全部产品
	(function(){
		var all_product = $("#nav .menu>ul>li:nth-child(2)");
		var allProduct_list = $("#nav .allProduct");
		var allProduct_li = $("#nav .menu>ul>li:nth-child(2)");
		all_product.hover(function(){
			allProduct_li.css("background-color","#F6F6F6");
			allProduct_list.stop().slideDown(300);
		},function(){
			allProduct_li.css("background-color","white");
			allProduct_list.stop().slideUp(300);
		});
		allProduct_list.hover(function(){
			allProduct_li.css("background-color","#F6F6F6");
			$(this).stop().show();
		},function(){
			allProduct_li.css("background-color","white");
			$(this).stop().slideUp(300);
		});
	})();
	
	//第一个广告区域
	(function(){
		var advert1Div = $("#advert1>div>a");
		advert1Div.hover(function(){
			$(this).find(".advert1Box").show();
		},function(){
			$(this).find(".advert1Box").hide();
		});
	})();
	
	//智感一握，耳目一新广告区域
	(function(){
		var advert2Li = $("#advert2 .advert2Main>ul>li>a");
		advert2Li.hover(function(){
			$(this).find(".advert2Box").hide();
		},function(){
			$(this).find(".advert2Box").show();
		});
	})();
	
	//立即购买
	(function(){
		var buyImmediatelyA = $("#buyImmediately .buyImmediatelyMain a");
		buyImmediatelyA.hover(function(){
			$(this).find(".hide").show();
		},function(){
			$(this).find(".hide").hide();
		});
	})();
	
	//底部
	(function(){
		var bottomMid = $("#bottom .bottomMid>span");//中间点击部分
		var bottomContent = $("#bottom");//获取底部
		var bottomMain = $("#bottom .bottomContent .bottomMid>span .bottomMain");//中间点击后展示部分
		
		var deleteCountry = $(".bottomLeft .bottomLeft_main .country .delete");//城市点击删除
		var country = $(".bottomLeft .bottomLeft_main .country");//城市点击后展示部分
		var bottomLeft = $("#bottom .bottomContent .bottomLeft");//城市点击部分
		
		var connect = $("#bottom .bottomContent .bottomRight .connect");//联系点击部分
		var connectMain = $("#bottom .bottomContent .bottomRight .connect .connectMain");//联系点击后展示部分
		//底部介绍
		var mid1 = 0;
		bottomMid.click(function(){
			mid1++;
			if(mid1%2 == 0){
				bottomMain.css('display','none');
				bottomMain.css("bottom","0px");
				$(this).css("background-position-x","-40px");
				bottomContent.css("bottom","0px");
			}else{
				bottomMain.css('display','block');
				bottomMain.css("bottom","600px");
				$(this).css("background-position-x","0px");
			    bottomContent.css("bottom","370px");
			    country.css('display','none');
			    connectMain.css('display','none');
			}
		});
		
		//国家/地区
		deleteCountry.click(function(){
			country.css("display","none");
		});
		
		var mid2 = 0;
		bottomLeft.click(function(){
			mid2++;
			if(mid2%2 == 0){
				country.css('display','none');
			}else{
				country.css('display','block');
				bottomMain.css('display','none');
				bottomContent.css("bottom","0px");
				connectMain.css('display','none');
			}
		});
		
		//连接
		var mid3 = 0;
		connect.click(function(){
			mid3++;
			if(mid3%2 == 0){
				connectMain.css('display','none');
			}else{
				connectMain.css('display','block');
				bottomMain.css('display','none');
				bottomContent.css("bottom","0px");
				country.css('display','none');
			}
		});
	})();
	
	//固定导航栏
	(function(){
		var topMain=$('#topAdvert').height();/*获取到Top的高度*/
        var nav=$('#nav');
        var menu = $("#nav .menu");
        var search = $("#nav .search");
        var logo = $("#nav .logo>a>img");
        var searchTop = $("#nav .search .search_top");
        var searchBottom = $("#nav .search .search_bottom");
        
        $(window).scroll(function(){
            if($(window).scrollTop()>topMain){
                nav.addClass('ScrollNav');
                searchBottom.css("display","none");
                searchTop.css("margin-top","0px");
                logo.css("margin-top","20px");
                menu.css("margin-top","-40px");
                nav.css("height","60px");
            }else{
                nav.removeClass('ScrollNav');
                searchBottom.css("display","block");
                searchTop.css("margin-top","0px");
                logo.css("margin-top","44px");
                menu.css("margin-top","0px");
                search.css("height","100px");
            }
        });
	})();
});
